import { Command } from '@/commands/command.ts'
import { new_command } from '@/models/command.ts'

export class JsonCommand extends Command {
    public static new(args: string): Command {
        const command = new_command()
        command.args = args
        command.name = 'json'
        command.component = 'JsonCommandComponent'

        return new JsonCommand(command, false)
    }

    usage(): string {
        return 'json [-s|--stringify] JSON字符串'
    }

    description(): string {
        return `<div>格式化给定的JSON字符串，默认为可阅读模式</div>
        <br/>
        <div>选项说明</div>
        <br/>
        <div class="option-row"><span class="option-option">-s --stringify</span>将给定JSON字符串压缩为单行</div>`
    }
}
